from LeetCoder import *


class Solution:

    def removeTrailingZeros(self, num: str) -> str:
        i = len(num) - 1
        while num[i] == '0' and i >= 0:
            i -= 1
        if i == -1:
            return "0"
        return num[:i + 1]

s = Solution()
print(s.removeTrailingZeros("51230100"))
print(s.removeTrailingZeros("123"))
print(s.removeTrailingZeros("0"))
